
import request from '@/service/request'
export const GET_ALLBLOG = "getallblog"
export const GET_BLOGTYPE = "getblogtype"
export const GET_CURRENTBLOG = "getcurrentblog"
export const GET_OTHERBLOGGER = "getotherblogger"
// export const GET_PERSONALBLOG = "getpersonalblog";

export const getallblogaction = (data) => ({
    type: GET_ALLBLOG,
    data
})
export const getblogtypeaction = (data) => ({
    type: GET_BLOGTYPE,
    data
})
export const getcurrentblogaction = (data) => ({
    type: GET_CURRENTBLOG,
    data
})
export const getotherbloggeraction = (data) => ({
    type: GET_OTHERBLOGGER,
    data
})
// export const getpersonalblogaction = (data) => ({
//     type: GET_PERSONALBLOG,
//     data
// })
//获取所有博客内容
export const getallblogactionasync = (id) => {
    return dispatch => {
        request.get(`travel/Blog?id=${id}`).then((res) => {
            dispatch(getallblogaction(res))
        })
    }
}
//获取博客分类
export const getblogtypeactionasync = () => {
    return dispatch => {
        request.get("travel/Blogtype").then((res) => {
            dispatch(getblogtypeaction(res))
        });
    }
}

//获取当前分类的博客
export const getcurrentblogactionasync = (id = -1) => {
    return dispatch => {
        request.get(`travel/Blog?id=${id}`).then((res) => {
            dispatch(getcurrentblogaction(res))
        })
    }
}

//获取其他博主的信息
export const getotherbloggeractionasync = () => {
    return dispatch => {
        request.get("travel/Getallblogger").then((res) => {
            dispatch(getotherbloggeraction(res))
        })
    }
}
// //根据用户id获取用户发表过的内容
// export const getpersonalblogactionasync = (id) => {
//     return dispatch => {
//         request.get(`travel/Personalblog?id=${id}`).then((res) => {
//             dispatch(getpersonalblogaction(res))
//         })
//     }
// }